<template>
  <div>
    <el-form ref="formItem" :model="formItem" label-width="100px" @submit.native.prevent>
      <el-form-item label="申请id：" v-if="formItem.id">
        <el-input class="form-sty" disabled v-model="formItem.id" placeholder style="width: 80%"></el-input>
      </el-form-item>
      <el-form-item label="门店名称：">
        <el-input
          class="form-sty"
          v-model="formItem.title"
          placeholder="请输入门店名称"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="门店类型：">
        <!-- <div v-if="formItem.company_type == 1">可接单型</div>
        <div v-if="formItem.company_type == 2">可发布服务型</div>-->
        <el-radio-group v-model="formItem.companyType">
          <el-radio :label="1" disabled>
            <span>可接单不发布服务型</span>
          </el-radio>
          <el-radio :label="2" disabled>
            <span>可接单可发布服务型</span>
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="联系人：">
        <el-input
          class="form-sty"
          v-model="formItem.linkName"
          placeholder="请输入联系人"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="联系人手机：">
        <el-input
          class="form-sty"
          v-model="formItem.linkMobile"
          placeholder="请输入联系人手机"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="所属城市：">
        <el-select v-model="formItem.cityId" class="form-sty" disabled>
          <el-option
            v-for="(item, index) in cityInfo"
            :key="index"
            :value="item.id"
            :label="item.cityName"
          ></el-option>
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="所在省：">
        <el-input class="form-sty" v-model="formItem.province" placeholder="请输入所在省" style="width: 80%"></el-input>
      </el-form-item>
      <el-form-item label="所在市：">
        <el-input class="form-sty" v-model="formItem.city" placeholder="请输入所在市" style="width: 80%"></el-input>
      </el-form-item>
      <el-form-item label="所在区：">
        <el-input class="form-sty" v-model="formItem.district" placeholder="请输入所在区" style="width: 80%"></el-input>
      </el-form-item>-->
      <el-form-item label="详细地址：">
        <el-input
          type="textarea"
          :autosize="{minRows: 3}"
          class="form-sty"
          v-model="formItem.detail"
          placeholder="请输入详细地址"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="简介：">
        <el-input
          type="textarea"
          class="form-sty"
          :autosize="{minRows: 3}"
          v-model.trim="formItem.shortDesc"
          placeholder="请输入简介"
          style="width: 80%"
        ></el-input>
      </el-form-item>
      <el-form-item label="驳回理由" v-if="formItem.status == 2">
        <el-input
          type="textarea"
          class="form-sty"
          disabled
          v-model.trim="formItem.rejectReason"
          placeholder="未填写驳回理由"
          style="width: 80%"
        ></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>
  
  <script>
import { cityList, getCompanyApplyFromDataApi } from '@/api/base';
export default {
  name: 'company_apply_edit',
  props: {
    id: 0,
  },
  watch: {},
  data() {
    return {
      modals: false,
      labelShow: false,
      customerShow: false,
      orderStatus: 0,
      total_num: 0,
      splitSwitch: true,
      formItem: {
        id: 0,
        title: '',
        shortDesc: '',
        linkName: '',
        linkMobile: '',
        detail: '',
        status: '',
        rejectReason: '',
        companyType: 1,
        cityId: 0,
      },
      dataLabel: [],
      cityInfo:[]
    };
  },
  created() {
    this.getCitys();
  },
  mounted() {
    this.getInfo();
  },
  methods: {
    getInfo() {
      getCompanyApplyFromDataApi({ id: this.id }).then((res) => {
        let data = res;
        Object.entries(this.formItem).forEach(([index, item]) => {
          this.formItem[index] = data[index];
        });
      });
    },
    //获取城市列表
    getCitys() {
      cityList({page:1,limit:999}).then((res) => {
        console.log(res)
        let data = res;
        this.cityInfo = data.list;
      });
    },
  },
};
</script>
  
  <style lang="stylus" scoped>
  .labelInput {
    border: 1px solid #dcdee2;
    width: 400px;
    padding: 0 8px;
    border-radius: 5px;
    min-height: 30px;
    cursor: pointer;

    .span {
      color: #c5c8ce;
    }

    .iconxiayi {
      font-size: 12px;
    }
  }

  .ivu-form-item {
    margin-bottom: 10px;
  }

  .form-sty {
    width: 400px !important;
  }

  .addfont {
    display: inline-block;
    font-size: 13px;
    font-weight: 400;
    color: #1890FF;
    margin-left: 14px;
    cursor: pointer;
    margin-left: 10px;
  }

  .ivu-icon-ios-arrow-down {
    font-size: 14px;
  }

  .tip {
    color: #bbb;
  }

  img {
    height: 36px;
    display: block;
  }
</style>
  